package com.hyacinth.web.ui.easyui;

import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;

public class ComboTree {

	public static String getData(List<?> list, Class<?> c, String[] fields) {
		SimplePropertyPreFilter spp = new SimplePropertyPreFilter(c, fields);
		String str = JSON.toJSONString(list,spp,SerializerFeature.DisableCircularReferenceDetect);
		return str.replace(",\"children\":[],", ",").replace("\"children\":[],", "").replace("\"name\"", "\"text\"");
	}
}
